//
//  HttpEngine.h
//  ChinaBookingPhone
//
//  Created by 杨 锐 on 14-7-2.
//  Copyright (c) 2014年 ChinaBooking. All rights reserved.
//

#import <UIKit/UIKit.h>
#import <Foundation/Foundation.h>
#import "AFNetworking.h"
#import <AssetsLibrary/AssetsLibrary.h>
#import "AppMacro.h"
#import "UtilsMacro.h"
#import "OSSData.h"
#import "OSSTool.h"
#import "OSSClient.h"
#import "JSONKit.h"

@interface HttpHelper : NSObject


+(void)HttpPostRequest:(NSString *)url
            parameters:(NSDictionary *)parameters
               success:(void (^)(id responseDic))success
               failure:(void (^)(NSError *error))failure;

+(void)HttpGetRequest:(NSString *)url
           parameters:(NSDictionary *)parameters
              success:(void (^)(id responseDic))success
              failure:(void (^)(NSError *error))failure;

+(void)HttpRequestWebservice:(NSString *)url
                  parameters:(NSDictionary *)parameters
                     success:(void (^)(id responseDic))success
                     failure:(void (^)(NSError *error))failure;

/**
 *  图片上传
 *
 *  @param url                  上传地址
 *  @param params               参数
 *  @param mediaDatas           上传文件数组图片或者视频
 *  @param image                图片Data
 *  @param mimeType             上传文件mime类型 图片：image/jpeg 视频：
 *  @param completionHandler    完成回调块
 *  @param ImgCompressionQuality图片压缩比率，0~1float值代表0%~100%
 *  @param ProgressBlock        图片上传中实时监控进度 参数:float类型从0~1代表0%~100%
 *  @param success              图片上传成功后回调 参数:服务器完成上传后的返回结果
 *  @param failure              图片上传失败回调 参数:上传出现失败时出现的错误对象
 注意:如若在上传图片时不需做任何处理也不需要任何服务器反馈，同事也不需要检测上传时出现的网络错误，可以将ProgressBlock、success、failure皆赋值为空
 *  @return 返回当前上传图片时所使用的的AFHTTPRequestOperation对象;
 */
+(AFHTTPRequestOperation *)HttpPostImgWithURL:(NSString *)url
                                       params:(NSDictionary*)params
                                    ImageData:(UIImage *)image
                        ImgCompressionQuality:(CGFloat)compressionQuality
                          UpLoadProgressBlock:(void (^)(float Progress))ProgressBlock
                            UpLoadWithSuccess:(void (^)(AFHTTPRequestOperation *result))success
                            UpLoadWithFailure:(void (^)(NSError *error))failure;

/**
 *  阿里云服务器上传图片
 *
 *  @param image            上传图片
 *  @param iamgeName        完整图片名
 *  @param uploadCallback   上传成功或失败回调
 *  @param progressCallback 上传进度回调
 */
+(void)ossuploadimage:(UIImage*)image
        fullimageName:(NSString*)fullimageName
       uploadCallback:(void (^)(BOOL isSuccess, NSError *error))uploadCallback
 withProgressCallback:(void (^)(float progressFloat))progressCallback;


@end
